<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/9/15
 * Time: 12:10
 */

namespace Home\Controller;

use Common\Controller\BaseHomeController;

class CategoryController extends BaseHomeController
{

    public function index()
    {
        $cid = I("cid");
        $map = array('category_id' => $cid);
        $articles =  $this->lists("Article", $map);

        foreach ($articles as $k => $val) {
            $articles[$k] = D("Article")->_format($val);
            $articles[$k]['create_time'] = getMyDate($articles[$k]['create_time']);

        }

        $this->assign('articles', $articles);
        $this->display();
    }
} 